using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using DomoBCI.Core.Stimulation.Internal;

namespace DomoBCI.Core.Stimulation.Tipi
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Scacchiera : StimulationBase
    {
        public float ScaleFactorX;
        public float ScaleFactorY;


        public Scacchiera(Game game)
            : base(game)
        {
            Stim1 = game.Content.Load<Texture2D>(@"Stimulation/Chess1");
            Stim2 = game.Content.Load<Texture2D>(@"Stimulation/Chess2");
            spriteBatch = (Game.Services.GetService(typeof(SharedContext)) as SharedContext).sprite_batch;
            //ScaleFactorX = (graphics.PreferredBackBufferWidth - 300) / 800.0f;
           // ScaleFactorY = (graphics.PreferredBackBufferHeight - 300) / 600.0f;
            LeftSq = Stim1;
            RightSq = Stim1;
            UpSq = Stim1;
            DownSq = Stim1;
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here

            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
           
            spriteBatch.Begin();
            //Stimolatore Destro
            if (left)
            {
                spriteBatch.Draw(LeftSq, new Rectangle(0, (StateManager.graphic.PreferredBackBufferHeight) / 2 - 75, 150, 150), Color.White);
            }
            //Stimolatore Sinistro
            if (right)
            {
                spriteBatch.Draw(RightSq, new Rectangle(StateManager.graphic.PreferredBackBufferWidth - 150, ((StateManager.graphic.PreferredBackBufferHeight) / 2) - 75, 150, 150), Color.White);
            }
            //Stimolatore Alto
            if (up)
            {
                spriteBatch.Draw(UpSq, new Rectangle(StateManager.graphic.PreferredBackBufferWidth / 2 - 75, 0, 150, 150), Color.White);
            }
            //Stimolatore Basso
            if (down)
            {
                spriteBatch.Draw(DownSq, new Rectangle(StateManager.graphic.PreferredBackBufferWidth / 2 - 75, StateManager.graphic.PreferredBackBufferHeight - 150, 150, 150), Color.White);
            }
            //base.Draw(gameTime);
            spriteBatch.End();


        }
    }
}
